﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DesignPattern.FlyweightPattern
{
    class Program
    {
        static void Main(string[] args)
        {
            //外部代码状态
            int extrinsicstate = 20;
            FlyweightFactory f = new FlyweightFactory();

            Flyweight fx = f.GetFlyweight("X");
            fx.Operation(--extrinsicstate);

            Flyweight fy = f.GetFlyweight("Y");
            fy.Operation(--extrinsicstate);

            Flyweight fz = f.GetFlyweight("Z");
            fz.Operation(--extrinsicstate);
            Flyweight fx2 = f.GetFlyweight("X");
            fx2.Operation(--extrinsicstate);

            Console.ReadKey();
        }
    }
}
